<template>
  <div class="Showcase1">
    <div class="Showcase1-top">
      <div
        class="light-box"
        v-for="(item, index) in props.list"
        :key="index"
        :style="{
          left: `${ShowcaseItemTransform(item.x ? item.x : getParentX(Number(index)), item.width, 1.733)}rem`,
          top: `${ShowcaseItemTransform(item.y ? item.y : getParentX(Number(index)), item.height, 5.833)}rem`,
        }"
      >
        <!-- <img v-lazy="publicUrls + 'free/style9/showcaseLight.webp'" alt=""  /> -->
        <div
          class="ex-light"
          :style="{
            backgroundImage: `url(${publicUrls + 'free/style9/showcaseLight.webp'})`,
          }"
        >
          <img :src="getLinkUrl(item.coverUrl, '?imageView2/3/w/600/format/webp')" alt="" />
        </div>
      </div>
      <div
        class="titile-box"
        v-for="(item, index) in props.list"
        :key="index"
        :style="{ left: `${ShowcaseItemTransform(item.x ? item.x : getParentX(Number(index)), item.width, 2.133)}rem` }"
      >
        <p>{{ item.name }}</p>
        <img :src="publicUrls + 'free/style9/cabinetStyle2Title.webp'" alt="" />
      </div>
      <img
        class="Showcase1-top-left"
        :src="publicUrls + 'free/style9/showcase2TopLeft.webp'"
        alt=""
      />
      <img
        class="Showcase1-top-center"
        :src="publicUrls + 'free/style9/showcase2TopCenter.webp'"
        alt=""
      />
      <img
        class="Showcase1-top-right"
        :src="publicUrls + 'free/style9/showcase2TopRight.webp'"
        alt=""
      />
    </div>
    <div class="Showcase1-center">
      <img
        class="Showcase1-center-left"
        :src="publicUrls + 'free/style9/showcase2CenterLeft.webp'"
        alt=""
      />
      <img
        class="Showcase1-center-center"
        :src="publicUrls + 'free/style9/showcase2CenterCon.webp'"
        alt=""
      />
      <img
        class="Showcase1-center-right"
        :src="publicUrls + 'free/style9/showcase2CenterRight.webp'"
        alt=""
      />
    </div>
    <div class="Showcase1-btm">
      <img
        class="Showcase1-btm-left"
        :src="publicUrls + 'free/style9/showcase2BtmLeft.webp'"
        alt=""
      />
      <img
        class="Showcase1-btm-con"
        :src="publicUrls + 'free/style9/showcase2BtmCenter.webp'"
        alt=""
      />
      <img
        class="Showcase1-btm-right"
        :src="publicUrls + 'free/style9/showcase2BtmRight.webp'"
        alt=""
      />
    </div>
    <!-- <div class="inverted">
      <img :src="publicUrls + 'free/style8/Showcase2Inverted1.webp'" alt="" class="left" />
      <div class="content"></div>
      <img :src="publicUrls + 'free/style8/Showcase2Inverted3.webp'" alt="" class="right" />
    </div> -->
  </div>
</template>

<script lang="ts">
export default defineComponent({
  name: 'free9Style2',
});
</script>
<script lang="ts" setup>
import { publicUrls } from '@/utils/minxin';
import { getLinkUrl } from '@/utils/request/upload';
import { ShowcaseItemTransform } from '@/utils/setmaterialStyle';
import { log } from 'console';
import { defineComponent } from 'vue';
const props = defineProps({
  list: {
    type: Object,
  },
});
console.log(props.list);
const getParentX = (indexs: number) => {
  let x = 0;
  for (let index = 0; index < indexs; index++) {
    // const element = array[index];
    x = x + props.list[index].width;
  }
  return x + 0.1;
};
</script>

<style lang="less" scoped>
.Showcase1 {
  display: flex;
  flex-direction: column;
  // align-items: center;
  width: 100%;
  min-width: 314px;
  height: 100%;
  position: relative;
}
.light-box {
  position: absolute;
  // top: -160px;
  width: 255px;
  height: 255px;
  .ex-light {
    width: 100%;
    height: 100%;
    background-repeat: no-repeat !important;
    background-size: 100% 100% !important;
    display: flex;
    align-items: center;
    justify-content: center;
    img {
      width: 1.05rem;
      height: 1.05rem;
      object-fit: contain;
      opacity: 0.1;
      margin-bottom: 10px;
    }
  }
}
.titile-box {
  position: absolute;
  top: 50px;
  // left: 0;
  width: 314px;
  height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  img {
    width: 260px;
    height: 5px;
    object-fit: cover;
    flex-shrink: 0;
  }
  p {
    flex-shrink: 0;
    width: 240px;
    color: #ebdcc4;
    text-align: center;
    text-shadow: 0px -1px 1px rgba(0, 0, 0, 0.1);
    font-family: 'SourceHanSerifCN';
    font-size: 18px;
    font-style: normal;
    font-weight: 700;
    line-height: 180%; /* 32.4px */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
.Showcase1-top {
  display: flex;
  height: 120px;
  width: calc(100% - 45px);
}
.Showcase1-top-left {
  width: 65px;
  height: 100%;
}
.Showcase1-top-center {
  width: 100%;
  height: 100%;
  min-width: 184px;
}
.Showcase1-top-right {
  width: 65px;
  height: 100%;
}
.Showcase1-center {
  display: flex;
  width: calc(100% - 45px);
  height: 100%;
  min-height: 70px;
  min-width: 184px;
}
.Showcase1-center-left {
  width: 65px;
  height: 100%;
  flex-shrink: 0;
}
.Showcase1-center-center {
  width: 100%;
  height: 100%;
  min-width: 184px;
}
.Showcase1-center-right {
  width: 65px;
  height: 100%;
  flex-shrink: 0;
}
.Showcase1-btm {
  width: calc(100% - 45px);
  display: flex;
  height: 86px;
  .Showcase1-btm-left {
    width: 65px;
    height: 100%;
  }
  .Showcase1-btm-con {
    width: 100%;
    min-width: 184px;
    height: 100%;
  }
  .Showcase1-btm-right {
    width: 65px;
    height: 100%;
  }
}
</style>
